<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>类的继承</title>
</head>
<body>
  
</body>

<script type="text/javascript">

  class Person {
    constructor(name, age) {
      this.name = name
      this.age = age
    }
    sayName() {
      return this.name
    }
    sayAge() {
      return this.age
    }
  }

  class Student extends Person {
    constructor(name, age, score) {
      super(name, age)
      this.score = score
    }
  }

  let s1 = new Student('zhangsan', 20, 500)
  console.log(s1);
  console.log('name', s1.sayName());


</script>
</html>